
#include "studio_macros.h"
#include "config/ModelConfig.h"
#include <filesystem>

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);  // 初始化渲染模块
VTK_MODULE_INIT(vtkInteractionStyle);  // 初始化交互模块


#include "Visualizer.h"
#include "ModelBuilder.h"

int main() {

	// 输入参数
	double width = 4.0;  // 底边宽度
	double height = 2.0; // 高度
	double theta = 30.0; // 腰与底边的垂线夹角

	// 创建等腰梯形
	TopoDS_Shape src_trapezoid = ModelBuilder::createIsoscelesTrapezoid(width, height, theta);
	ModelBuilder::CheckShapeType(src_trapezoid);
	vtkSmartPointer<vtkPolyData> src_vtk_trapezoid = ModelBuilder::convertToVTK_3(src_trapezoid);
	//Visualizer::visualizeModel(src_vtk_trapezoid);
	Visualizer::visualizeModelWithPicking(src_vtk_trapezoid);

	//// 拉伸二维梯形为三维实体
	// 指定 Z 轴方向的拉伸向量
	double distance = 2.0;
	gp_Vec direction(0, 0, distance);
	TopoDS_Shape extruded_trapezoid = ModelBuilder::extrude(src_trapezoid, direction);
	ModelBuilder::CheckShapeType(extruded_trapezoid);

	vtkSmartPointer<vtkPolyData> extrudedModel = ModelBuilder::convertToVTK_3(extruded_trapezoid);
	// 展示模型
	//Visualizer::visualizeModel(extrudedModel);
	Visualizer::visualizeModelWithPicking(extrudedModel);

	return 0;
}

//int main() 
//{
//    // 参数化构建等腰梯形
//    double width = 4.0;  // 底边宽度
//    double height = 2.0; // 高度
//    double theta = 30.0; // 角度
//    vtkSmartPointer<vtkPolyData> trapezoid = ModelBuilder::createIsoscelesTrapezoid_back(width, height, theta);
//    // 拉伸二维梯形为三维实体
	//vtkSmartPointer<vtkLinearExtrusionFilter> extrudeFilter = vtkSmartPointer<vtkLinearExtrusionFilter>::New();
	//extrudeFilter->SetInputData(trapezoid);
	//extrudeFilter->SetExtrusionTypeToVectorExtrusion();
	//extrudeFilter->SetVector(0, 0, 1); // 沿Z轴拉伸
	//extrudeFilter->SetScaleFactor(2.0); // 拉伸长度
	//extrudeFilter->Update();
	//// 获取拉伸后的三维模型
	//vtkSmartPointer<vtkPolyData> extrudedModel = extrudeFilter->GetOutput();
	//// 展示模型
	//Visualizer::visualizeModel(extrudedModel);
//    return 0;
//}

